CUSTOM Windows API 1.14
Loading...
Searching...
No Matches
CuCustomWndAPI.cpp File Reference

Contains all library APIs. Main file for CuCustomWndAPI library. More...

Functions

CcwResult WINAPI InitLibrary (CcwLogVerbosity logVerbosityLevel, wchar_t *pstrLogFolder)
 
CcwResult WINAPI DeInitLibrary ()
 
CcwResult WINAPI CloseDevice (DWORD device)
 
CcwResult WINAPI CloseAllDevices ()
 
CcwResult WINAPI GetAPIVersion (wchar_t *pAPIVersion)
 
CcwResult WINAPI GetInfoPrinterId (DWORD device, WORD *pwPrinterID)
 
CcwResult WINAPI GetInfoFirmwareVersion (DWORD device, wchar_t *pFirmwareVersion)
 
CcwResult WINAPI GetInfoDeviceModel (DWORD device, wchar_t *pDeviceModel)
 
CcwResult WINAPI GetCapCommPortType (DWORD device, CommunicationPortType *pcomPortType)
 
CcwResult WINAPI GetCapPrintAvailable (DWORD device, BOOL *pbPrnAvailable)
 
CcwResult WINAPI GetCapPrinterResolution (DWORD device, DWORD *pdwPrinterResolution)
 
CcwResult WINAPI GetCapPrintWidth (DWORD device, DWORD *pdwPageWidth)
 
CcwResult WINAPI SetCapPrintWidth (DWORD device, DWORD dwNewPrintWidth)
 
CcwResult WINAPI GetCapCodepagesList (DWORD device, wchar_t *pCodePagesList, DWORD *pdwStringBufferSize)
 
CcwResult WINAPI SetVirtualPaperEndLimit (DWORD device, DWORD dwVirtualPaperEndLimitCm)
 
CcwResult WINAPI CommGetReadTimeout (DWORD device, DWORD *pdwRTimeout)
 
CcwResult WINAPI CommSetReadTimeout (DWORD device, DWORD dwRTimeout)
 
CcwResult WINAPI CommGetWriteTimeout (DWORD device, DWORD *pdwWTimeout)
 
CcwResult WINAPI CommSetWriteTimeout (DWORD device, DWORD dwWTimeout)
 
CcwResult WINAPI CommClearReadBuffer (DWORD device)
 
CcwResult WINAPI CommClearWriteBuffer (DWORD device)
 
CcwResult WINAPI CommRead (DWORD device, BYTE *bDataRead, DWORD dwDataReadSize, DWORD *pdwReadDataSize)
 
CcwResult WINAPI CommWrite (DWORD device, BYTE *bDataToWrite, DWORD dwDataToWriteSize, DWORD *pdwWrittenData)
 
CcwResult WINAPI TransactionPrint (DWORD device, TrPrintMode tpMode)
 
CcwResult WINAPI Feed (DWORD device, DWORD dwnFeeds)
 
CcwResult WINAPI Cut (DWORD device, CutType cuttype)
 
CcwResult WINAPI OpenCashDrawer (DWORD device, CashDrawerType drawerType, DWORD dwTimeOn, DWORD dwTimeOff)
 
CcwResult WINAPI Eject (DWORD device, EjectType ejtype)
 
CcwResult WINAPI EjectWithTimeout (DWORD device, EjectType ejtype, DWORD dwTimeOutms)
 
CcwResult WINAPI Present (DWORD device, DWORD dwpresentMM)
 
CcwResult WINAPI Align (DWORD device, PaperAlignType aligntype)
 
CcwResult WINAPI PrinterIsReady (DWORD device, BOOL *pbReady)
 
CcwResult WINAPI GetPrinterFullStatus (DWORD device, BYTE *pBuffer, PrinterStatusStruct *pStatusStruct)
 
CcwResult WINAPI GetInstalledPrinterFullStatus (wchar_t *pstrPrinterName, BYTE *pBuffer, PrinterStatusStruct *pStatusStruct)
 
CcwResult WINAPI ResetDevice (DWORD device, BOOL bWaitReset)
 
CcwResult WINAPI DeletePrinterInternalQueue (DWORD device)
 
CcwResult WINAPI GetCounter (DWORD device, DevCounterType devCounter, DWORD *pdwCounterValue)
 
CcwResult WINAPI PrintText (DWORD device, wchar_t *pText, BOOL bAddLF)
 
CcwResult WINAPI PrintTextEx (DWORD device, wchar_t *pText, PrintFontStruct *pfontStruct, BOOL bAddLF)
 
CcwResult WINAPI PrintTextUTF8 (DWORD device, char *pText, BOOL bAddLF)
 
CcwResult WINAPI PrintTextUTF8Ex (DWORD device, char *pText, PrintFontStruct *pfontStruct, BOOL bAddLF)
 
CcwResult WINAPI SetIgnoreWhiteImages (DWORD device, BOOL bIgnore)
 
CcwResult WINAPI SetGrModeToBlackWhite (DWORD device, ImageGRMode imgGrModeType, BYTE bThreshold)
 
CcwResult WINAPI SetPageModeToRoll (DWORD device, BOOL bRollMode)
 
CcwResult WINAPI SetGraphicsTopMargin (DWORD device, DWORD dwTopMargin)
 
CcwResult WINAPI GetGraphicsTopMargin (DWORD device, DWORD *pdwTopMargin)
 
CcwResult WINAPI PrintImageFromPath (DWORD device, wchar_t *pstrImageFilePath, PrintImageStruct *pImageStruct)
 
CcwResult WINAPI PrintRawImage (DWORD device, RAWBitDepth bits, BYTE *pRawBuffer, DWORD dwRawBufferSize, DWORD dwWidth, DWORD dwHeight, PrintImageStruct *pImageStruct)
 
CcwResult WINAPI PrintBarcodeString (DWORD device, wchar_t *strBrcText, PrintBarcodeStruct *pBarcodeStruct)
 
CcwResult WINAPI PrintBarcodeBuffer (DWORD device, BYTE *bBrcBuffer, DWORD dwSrcBufferSize, PrintBarcodeStruct *pBarcodeStruct)
 
CcwResult WINAPI SetVariable (DWORD device, wchar_t *var, void *value)
 
CcwResult WINAPI GetVariable (DWORD device, wchar_t *var, void *value)
 
CcwResult WINAPI SetOpenDeviceMode (OpenDeviceMode ode)
 
CcwResult WINAPI GetOpenDeviceMode (OpenDeviceMode *pode)
 
CcwResult WINAPI RawDataToPrintSpooler (wchar_t *pstrPrinterName, BYTE *bDataToWrite, DWORD dwDataToWriteSize, wchar_t *strDocName)
 
CcwResult WINAPI BinFileToPrintSpooler (wchar_t *pstrPrinterName, wchar_t *pstrFilePath, wchar_t *strDocName)
 
CcwResult WINAPI EnumInstalledPrinters (PrinterStruct *pPrintersArray, LPDWORD pdwNumPrinter)
 
CcwResult WINAPI OpenInstalledPrinter (wchar_t *pstrPrinterName, DWORD *pdwPrinterDevID)
 
CcwResult WINAPI EnumUSBDevices (USBDeviceStruct *pUSBDevicesArray, LPDWORD pdwNumDevices)
 
CcwResult WINAPI OpenPrinterUSB (WORD wVID, WORD wPID, wchar_t *pstrSN, DWORD *pdwPrinterDevID)
 
CcwResult WINAPI OpenPrinterUSBEx (USBDeviceStruct *pUsbDev, DWORD *pdwPrinterDevID)
 
CcwResult WINAPI EnumETHDevices (ETHDeviceStruct *pETHDevicesArray, LPDWORD pdwNumDevices, DWORD dwSearchTimeout)
 
CcwResult WINAPI OpenPrinterETH (wchar_t *strPrinterIPAddress, DWORD dwPrinterIPPort, DWORD *pdwPrinterDevID)
 
CcwResult WINAPI OpenPrinterETHEx (ETHDeviceStruct *pEthDev, DWORD *pdwPrinterDevID)
 
CcwResult WINAPI EnumCOMPorts (COMPortStruct *pCOMPortsArray, LPDWORD pdwNumPorts)
 
CcwResult WINAPI OpenPrinterCOM (wchar_t *strPrinterComPort, DWORD *pdwPrinterDevID)
 
CcwResult WINAPI OpenPrinterCOMEx (COMPortStruct *pComDev, DWORD *pdwPrinterDevID)
 

Detailed Description

Contains all library APIs. Main file for CuCustomWndAPI library.

Function Documentation

◆ Align()

CcwResult WINAPI Align ( DWORD  device,
PaperAlignType  aligntype 
)

Send align command to the device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]aligntypethe PaperAlignType type to send to the device.
Note
This command will be effective only if "black mark alignment" is enabled in printer setup (for further information, refer to the User Manual of each device).
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ BinFileToPrintSpooler()

CcwResult WINAPI BinFileToPrintSpooler ( wchar_t *  pstrPrinterName,
wchar_t *  pstrFilePath,
wchar_t *  strDocName 
)

Send a binary file into the printer spooler queue

Parameters
[in]pstrPrinterNameA null terminated string that is the installed printer name.
[in]pstrFilePathA null terminated string with the file name to send to the printer spooler queue.
[in]strDocNameA null terminated string that is the document name (this value will be visible into the spooler queue).
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ CloseAllDevices()

CcwResult WINAPI CloseAllDevices ( )

Close the communication with all the devices.

Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.
See also
DeInitLibrary

◆ CloseDevice()

CcwResult WINAPI CloseDevice ( DWORD  device)

Close the communication with a device.

Parameters
[in]deviceThe device ID indicating which device the application will close the communications.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.
See also
DeInitLibrary

Referenced by CloseAllDevices().

◆ CommClearReadBuffer()

CcwResult WINAPI CommClearReadBuffer ( DWORD  device)

Clean the read buffer of the communication port of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ CommClearWriteBuffer()

CcwResult WINAPI CommClearWriteBuffer ( DWORD  device)

Clean the write buffer of the communication port of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ CommGetReadTimeout()

CcwResult WINAPI CommGetReadTimeout ( DWORD  device,
DWORD *  pdwRTimeout 
)

Get the read timeout of the communication port of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pdwRTimeoutA pointer to the number that is the read timeout (msec), for the communication port, of this device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ CommGetWriteTimeout()

CcwResult WINAPI CommGetWriteTimeout ( DWORD  device,
DWORD *  pdwWTimeout 
)

Get the write timeout of the communication port of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pdwWTimeoutA pointer to the number that is the write timeout (msec), for the communication port, of this device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ CommRead()

CcwResult WINAPI CommRead ( DWORD  device,
BYTE *  bDataRead,
DWORD  dwDataReadSize,
DWORD *  pdwReadDataSize 
)

Direct read from communication port of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]bDataReadpointer to buffer where received data shall stored
[in]dwDataReadSizelength of reserved buffer
[out]pdwReadDataSizepointer to value where the number of received bytes is stored
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ CommSetReadTimeout()

CcwResult WINAPI CommSetReadTimeout ( DWORD  device,
DWORD  dwRTimeout 
)

Set the read timeout of the communication port of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]dwRTimeoutthe value that will be the new read timeout (msec), for the communication port, of this device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ CommSetWriteTimeout()

CcwResult WINAPI CommSetWriteTimeout ( DWORD  device,
DWORD  dwWTimeout 
)

Set the write timeout of the communication port of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]dwWTimeoutthe value that will be the write timeout (msec), for the communication port, of this device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ CommWrite()

CcwResult WINAPI CommWrite ( DWORD  device,
BYTE *  bDataToWrite,
DWORD  dwDataToWriteSize,
DWORD *  pdwWrittenData 
)

Direct write to communication port of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]bDataToWritepointer to buffer to send
[in]dwDataToWriteSizelength of buffer to send
[out]pdwWrittenDatapointer to value where the number of sended bytes is stored
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ Cut()

CcwResult WINAPI Cut ( DWORD  device,
CutType  cuttype 
)

Send cut command to the device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]cuttypethe CutType type to send to the device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ DeInitLibrary()

CcwResult WINAPI DeInitLibrary ( )

De-initialize library. Call this function as the last function before your application unloads the library.

Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.
See also
InitLibrary

◆ DeletePrinterInternalQueue()

CcwResult WINAPI DeletePrinterInternalQueue ( DWORD  device)

Clear / Delete the internal queue of the device.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

Send the clear

◆ Eject()

CcwResult WINAPI Eject ( DWORD  device,
EjectType  ejtype 
)

Send eject command to the device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]ejtypethe EjectType type to send to the device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ EjectWithTimeout()

CcwResult WINAPI EjectWithTimeout ( DWORD  device,
EjectType  ejtype,
DWORD  dwTimeOutms 
)

Send eject with a timeout command to the device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]ejtypethe EjectType type to send to the device.
[in]dwTimeOutmsthe time in milliseconds after which the movement is performed.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ EnumCOMPorts()

CcwResult WINAPI EnumCOMPorts ( COMPortStruct *  pCOMPortsArray,
LPDWORD  pdwNumPorts 
)

Enum the COM Ports found.

Parameters
[out]pCOMPortsArraythe pointer to COMPortStruct array of all the COM ports found. This array must have been allocated by the calling process.
[out]pdwNumPortsThe pointer to the value indicating the number of COM Ports found.
Note
: if the pCOMPortsArray is NULL the pdwNumPorts indicates always the number of COM Ports found.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ EnumETHDevices()

CcwResult WINAPI EnumETHDevices ( ETHDeviceStruct *  pETHDevicesArray,
LPDWORD  pdwNumDevices,
DWORD  dwSearchTimeout 
)

Enum the Ethernet/Wifi devices connected.

Parameters
[out]pETHDevicesArraythe pointer to ETHDeviceStruct array of all the Ethernet/Wifi devices found. This array must have been allocated by the calling process.
[out]pdwNumDevicesThe pointer to the value indicating the number of Ethernet/Wifi devices found.
[in]dwSearchTimeoutThe timeout to search the ethernet / wifi devices, minimum 300 (ms)
Note
: if the pETHDevicesArray is NULL the pdwNumDevices indicates always the number of Ethernet/Wifi devices found.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ EnumInstalledPrinters()

CcwResult WINAPI EnumInstalledPrinters ( PrinterStruct *  pPrintersArray,
LPDWORD  pdwNumPrinter 
)

Enum the supported printers installed.

Parameters
[out]pPrintersArraythe pointer to PrinterStruct array of all the supported printers installed. This array must have been allocated by the calling process.
[out]pdwNumPrinterThe pointer to the value indicating the number of supported printers installed.
Note
: if the pPrintersArray is NULL the pdwNumPrinter indicates always the number of supported printers installed.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ EnumUSBDevices()

CcwResult WINAPI EnumUSBDevices ( USBDeviceStruct *  pUSBDevicesArray,
LPDWORD  pdwNumDevices 
)

Enum the usb devices connected.

Parameters
[out]pUSBDevicesArraythe pointer to USBDeviceStruct array of all the usb devices found. This array must have been allocated by the calling process.
[out]pdwNumDevicesThe pointer to the value indicating the number of usb devices found.
Note
: if the pUSBDevicesArray is NULL the pdwNumDevices indicates always the number of usb devices found.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ Feed()

CcwResult WINAPI Feed ( DWORD  device,
DWORD  dwnFeeds 
)

Send line feed commands to the device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]dwnFeedsthe number of line feed to send to the device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetAPIVersion()

CcwResult WINAPI GetAPIVersion ( wchar_t *  pAPIVersion)

Current API version

Parameters
[out]pAPIVersionA null terminated string containing the library release. This buffer must have been allocated by the calling process.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetCapCodepagesList()

CcwResult WINAPI GetCapCodepagesList ( DWORD  device,
wchar_t *  pCodePagesList,
DWORD *  pdwStringBufferSize 
)

The list of all the codepages supported by the library / device.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pCodePagesListA pointer to the string where will be saved the codepages list string (comma separated).
[in]pdwStringBufferSizeA pointer to the number that is string size.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetCapCommPortType()

CcwResult WINAPI GetCapCommPortType ( DWORD  device,
CommunicationPortType *  pcomPortType 
)

Get the type of communication port used by the device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pcomPortTypeA pointer to CommunicationPortType, allocated by the calling process, that contains the communication port type.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetCapPrintAvailable()

CcwResult WINAPI GetCapPrintAvailable ( DWORD  device,
BOOL *  pbPrnAvailable 
)

Get if this device supports print functions.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pbPrnAvailableA pointer to the boolean value to know if this device supports print functions.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetCapPrinterResolution()

CcwResult WINAPI GetCapPrinterResolution ( DWORD  device,
DWORD *  pdwPrinterResolution 
)

Get the print resolution of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pdwPrinterResolutionA pointer to the number that is the print resolution.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetCapPrintWidth()

CcwResult WINAPI GetCapPrintWidth ( DWORD  device,
DWORD *  pdwPageWidth 
)

Get the print width of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pdwPageWidthA pointer to the number that is the print width (dots) of this device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetCounter()

CcwResult WINAPI GetCounter ( DWORD  device,
DevCounterType  devCounter,
DWORD *  pdwCounterValue 
)

Get a device counter

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]devCounterThe DevCounter that identify the counter to get from the device.
[out]pdwCounterValueA pointer to a DWORD value with the counter.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetGraphicsTopMargin()

CcwResult WINAPI GetGraphicsTopMargin ( DWORD  device,
DWORD *  pdwTopMargin 
)

Get the top margin added to the graphics print.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pdwTopMarginThe fixed top margin (dots) added to every print in graphics mode.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetInfoDeviceModel()

CcwResult WINAPI GetInfoDeviceModel ( DWORD  device,
wchar_t *  pDeviceModel 
)

Get the Device Model

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pDeviceModelA null terminated string containing the Model of this device. This buffer must have been allocated by the calling process.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetInfoFirmwareVersion()

CcwResult WINAPI GetInfoFirmwareVersion ( DWORD  device,
wchar_t *  pFirmwareVersion 
)

Get the Firmware Version

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pFirmwareVersionA null terminated string containing the Firmware release of this device. This buffer must have been allocated by the calling process.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetInfoPrinterId()

CcwResult WINAPI GetInfoPrinterId ( DWORD  device,
WORD *  pwPrinterID 
)

Get the Printer ID

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pwPrinterIDA WORD that containing the Printer ID.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetInstalledPrinterFullStatus()

CcwResult WINAPI GetInstalledPrinterFullStatus ( wchar_t *  pstrPrinterName,
BYTE *  pBuffer,
PrinterStatusStruct *  pStatusStruct 
)

Open the communication port, Get the status of a installed printer and close the communication with the device.

Parameters
[in]pstrPrinterNameA null terminated string that is the installed printer name.
[out]pBufferA pointer to 4 bytes buffer, allocated by the calling process, that contains the printer status.
[out]pStatusStructA pointer to PrinterStatusStruct, allocated by the calling process, that contains the printer status.
Note
At least one of the out pointers (pBuffer or pStatusStruct) must be not NULL.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetOpenDeviceMode()

CcwResult WINAPI GetOpenDeviceMode ( OpenDeviceMode *  pode)

Get the current open mode for the devices

Parameters
[in]podepointer to the different way to open the communication channels of the device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetPrinterFullStatus()

CcwResult WINAPI GetPrinterFullStatus ( DWORD  device,
BYTE *  pBuffer,
PrinterStatusStruct *  pStatusStruct 
)

Get the status of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pBufferA pointer to 4 bytes buffer, allocated by the calling process, that contains the printer status.
[out]pStatusStructA pointer to PrinterStatusStruct, allocated by the calling process, that contains the printer status.
Note
At least one of the out pointers (pBuffer or pStatusStruct) must be not NULL.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ GetVariable()

CcwResult WINAPI GetVariable ( DWORD  device,
wchar_t *  var,
void *  value 
)

Get the value of an internal "parameter"

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]varA null terminated string that is the variable ID.
[out]valuepointer to the value of the variable.
Note
Only for internal use
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ InitLibrary()

CcwResult WINAPI InitLibrary ( CcwLogVerbosity  logVerbosityLevel,
wchar_t *  pstrLogFolder 
)

Initializes library. This must be the first call after the LoadLibrary.

Parameters
[in]logVerbosityLevela CcwLogVerbosity Verbosity level.
[in]pstrLogFolderLog folder path. If NULL, the library uses the default path: "%Documents and settings%\CUSTOM\CuCustomWndAPI\Log".
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.
Note
Call this function from the main thread. In case it is called from a secondary thread, some functions could be disabled.
See also
DeInitLibrary

◆ OpenCashDrawer()

CcwResult WINAPI OpenCashDrawer ( DWORD  device,
CashDrawerType  drawerType,
DWORD  dwTimeOn,
DWORD  dwTimeOff 
)

Generate pulse on the drawer connector

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]drawerTypeconnector pin type
[in]dwTimeOnthe pulse ON time in milliseconds
[in]dwTimeOffthe pulse OFF time in milliseconds
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ OpenInstalledPrinter()

CcwResult WINAPI OpenInstalledPrinter ( wchar_t *  pstrPrinterName,
DWORD *  pdwPrinterDevID 
)

Open the communication with a Installed printer

Parameters
[in]pstrPrinterNameA null terminated string that is the installed printer name.
[out]pdwPrinterDevIDThe pointer to the device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ OpenPrinterCOM()

CcwResult WINAPI OpenPrinterCOM ( wchar_t *  strPrinterComPort,
DWORD *  pdwPrinterDevID 
)

Open the communication with a COM port to printer

Parameters
[in]strPrinterComPortthe string with the COM port to open.
[out]pdwPrinterDevIDThe pointer to the device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ OpenPrinterCOMEx()

CcwResult WINAPI OpenPrinterCOMEx ( COMPortStruct *  pComDev,
DWORD *  pdwPrinterDevID 
)

Open the communication with a COM port to printer

Parameters
[in]pComDevthe COMPortStruct with all the parameters of the COM Port to open.
[out]pdwPrinterDevIDThe pointer to the device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ OpenPrinterETH()

CcwResult WINAPI OpenPrinterETH ( wchar_t *  strPrinterIPAddress,
DWORD  dwPrinterIPPort,
DWORD *  pdwPrinterDevID 
)

Open the communication with a Ethernet / WIFI printer

Parameters
[in]strPrinterIPAddressthe string with the IP Address of the printer to open.
[in]dwPrinterIPPortthe network port to open int the printer. If this value is 0, it is automatically set to the default for the RAW print port (9100)
[out]pdwPrinterDevIDThe pointer to the device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ OpenPrinterETHEx()

CcwResult WINAPI OpenPrinterETHEx ( ETHDeviceStruct *  pEthDev,
DWORD *  pdwPrinterDevID 
)

Open the communication with a Ethernet / WIFI printer

Parameters
[in]pEthDevthe ETHDeviceStruct with all the parameters of the ETH/Wifi printer to open.
[out]pdwPrinterDevIDThe pointer to the device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ OpenPrinterUSB()

CcwResult WINAPI OpenPrinterUSB ( WORD  wVID,
WORD  wPID,
wchar_t *  pstrSN,
DWORD *  pdwPrinterDevID 
)

Open the communication with a USB printer

Parameters
[in]wVIDthe USB Vendor ID of the printer to open.
[in]wPIDthe USB Product ID of the printer to open.
[in]pstrSNthe USB Serial Number of the printer to open.
[out]pdwPrinterDevIDThe pointer to the device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ OpenPrinterUSBEx()

CcwResult WINAPI OpenPrinterUSBEx ( USBDeviceStruct *  pUsbDev,
DWORD *  pdwPrinterDevID 
)

Open the communication with a USB printer

Parameters
[in]pUsbDevthe USBDeviceStruct with all the parameters of the USB printer to open.
[out]pdwPrinterDevIDThe pointer to the device ID indicating which device the application will communicate to.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ Present()

CcwResult WINAPI Present ( DWORD  device,
DWORD  dwpresentMM 
)

Send presentation command to the device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]dwpresentMMthe value (mm) of the presentation to send to the device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ PrintBarcodeBuffer()

CcwResult WINAPI PrintBarcodeBuffer ( DWORD  device,
BYTE *  bBrcBuffer,
DWORD  dwSrcBufferSize,
PrintBarcodeStruct *  pBarcodeStruct 
)

Print barcode file from buffer

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]bBrcBufferpointer to buffer to print into barcode
[in]dwSrcBufferSizelength of buffer to print into barcode
[in]pBarcodeStructthe pointer to PrintBarcodeStruct with all the parameters / Attributes to use to print the barcode.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ PrintBarcodeString()

CcwResult WINAPI PrintBarcodeString ( DWORD  device,
wchar_t *  strBrcText,
PrintBarcodeStruct *  pBarcodeStruct 
)

Print barcode file from String

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]strBrcTextA null terminated string to print into barcode.
[in]pBarcodeStructthe pointer to PrintBarcodeStruct with all the parameters / Attributes to use to print the barcode.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ PrinterIsReady()

CcwResult WINAPI PrinterIsReady ( DWORD  device,
BOOL *  pbReady 
)

Check if the device is ready

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pbReadyA pointer to a boolean value that is TRUE if the communication with the device is ok.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ PrintImageFromPath()

CcwResult WINAPI PrintImageFromPath ( DWORD  device,
wchar_t *  pstrImageFilePath,
PrintImageStruct *  pImageStruct 
)

Print image file from path.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pstrImageFilePathA null terminated string with the file path.
[in]pImageStructthe pointer to PrintImageStruct with all the parameters / Attributes to use to print the image.
Note
The file formats supported are BMP, GIF, JPEG, PNG, TIFF, Exif, WMF, and EMF.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ PrintRawImage()

CcwResult WINAPI PrintRawImage ( DWORD  device,
RAWBitDepth  bits,
BYTE *  pRawBuffer,
DWORD  dwRawBufferSize,
DWORD  dwWidth,
DWORD  dwHeight,
PrintImageStruct *  pImageStruct 
)

Print RAW image buffer.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]bitsbit deph of the RAW data
[in]pRawBufferpointer to RAW buffer to print
[in]dwRawBufferSizelength of RAW buffer to print
[in]dwWidthwidth (pixels/dots) of the of RAW image
[in]dwHeightheight (pixels/dots) of the of RAW image
[in]pImageStructthe pointer to PrintImageStruct with all the parameters / Attributes to use to print the image.
Note
For a correct Monochromatic RAW 1 bit buffer, the size must be always ((width in terms of bytes per row) * Height). About the colors palette, if the bit is 0 it will be a black dot and if if the bit is 1 it will be a white dot.
For a correct Greyscale RAW 8 bit buffer, the size must be always (Width * Height). About the colors palette, the byte 0x00 is the black and the 0xFF is the white.
For a correct RGB RAW 24 bit buffer, the size must be always (Width * Height * 3). About the colors palette, the color 0x000000 is the black and the 0xFFFFFF is the white.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ PrintText()

CcwResult WINAPI PrintText ( DWORD  device,
wchar_t *  pText,
BOOL  bAddLF 
)

Print text on a printer.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pTextA null terminated string to print.
[in]bAddLFThe boolean that is TRUE if must be send a line feed command after the text.
Note
This function uses the last font attributes (or the default one if never used) to print the text.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ PrintTextEx()

CcwResult WINAPI PrintTextEx ( DWORD  device,
wchar_t *  pText,
PrintFontStruct *  pfontStruct,
BOOL  bAddLF 
)

Print text on a printer (with text parameters / Attributes ).

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pTextA null terminated string to print.
[in]pfontStructThe pointer to PrintFontStruct with all the parameters / Attributes to use to print the text.
[in]bAddLFThe boolean that is TRUE if must be send a line feed command after the text.
Note
This function uses the last font attributes (or the default one if never used) to print the text.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ PrintTextUTF8()

CcwResult WINAPI PrintTextUTF8 ( DWORD  device,
char *  pText,
BOOL  bAddLF 
)

Print UTF-8 encoded text on a printer.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pTextA null terminated UTF-8 string to print.
[in]bAddLFThe boolean that is TRUE if must be send a line feed command after the text.
Note
This function uses the last font attributes (or the default one if never used) to print the text.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ PrintTextUTF8Ex()

CcwResult WINAPI PrintTextUTF8Ex ( DWORD  device,
char *  pText,
PrintFontStruct *  pfontStruct,
BOOL  bAddLF 
)

Print UTF-8 encoded text on a printer (with text parameters / Attributes ).

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pTextA null terminated UTF-8 string to print.
[in]pfontStructThe pointer to PrintFontStruct with all the parameters / Attributes to use to print the text.
[in]bAddLFThe boolean that is TRUE if must be send a line feed command after the text.
Note
This function uses the last font attributes (or the default one if never used) to print the text.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ RawDataToPrintSpooler()

CcwResult WINAPI RawDataToPrintSpooler ( wchar_t *  pstrPrinterName,
BYTE *  bDataToWrite,
DWORD  dwDataToWriteSize,
wchar_t *  strDocName 
)

Send a buffer into the printer spooler queue

Parameters
[in]pstrPrinterNameA null terminated string that is the installed printer name.
[in]bDataToWritepointer to buffer to send to the printer spooler queue
[in]dwDataToWriteSizelength of buffer to send to the printer spooler queue
[in]strDocNameA null terminated string that is the document name (this value will be visible into the spooler queue).
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ ResetDevice()

CcwResult WINAPI ResetDevice ( DWORD  device,
BOOL  bWaitReset 
)

Reset the device.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]bWaitResetThe boolean that is TRUE if must be wait the reset and the re-open before exit. If bWaitReset is FALSE, must be close and re-open the device communcation before continue.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ SetCapPrintWidth()

CcwResult WINAPI SetCapPrintWidth ( DWORD  device,
DWORD  dwNewPrintWidth 
)

Set the print width of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]dwNewPrintWidthThe number that will be the print width (dots) of this device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ SetGraphicsTopMargin()

CcwResult WINAPI SetGraphicsTopMargin ( DWORD  device,
DWORD  dwTopMargin 
)

Set the top margin added to the graphics print.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]dwTopMarginThe fixed top margin (dots) added to every print in graphics mode (default is 16).
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ SetGrModeToBlackWhite()

CcwResult WINAPI SetGrModeToBlackWhite ( DWORD  device,
ImageGRMode  imgGrModeType,
BYTE  bThreshold 
)

Set the graphic conversion mode to Black/White and, if necessary, the threshold

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]imgGrModeTypethe ImageGRMode conversion to black / white mode.
[in]bThresholdthe threshold value to use (only for ImageGRMode::IMAGE_GRMODE_THRESHOLD mode).
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ SetIgnoreWhiteImages()

CcwResult WINAPI SetIgnoreWhiteImages ( DWORD  device,
BOOL  bIgnore 
)

Set if ignore, or not, the white Images

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]bIgnoreThe boolean that is TRUE when a totally white Image must be ignored and not print (default is FALSE).
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ SetOpenDeviceMode()

CcwResult WINAPI SetOpenDeviceMode ( OpenDeviceMode  ode)

Set the open mode for the devices

Parameters
[in]odeThe different way to open the communication channels of the device.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ SetPageModeToRoll()

CcwResult WINAPI SetPageModeToRoll ( DWORD  device,
BOOL  bRollMode 
)

Set the page mode print to Roll mode.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]bRollModeThe boolean that is TRUE when the printer prints until the last not white line (default is FALSE).
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ SetVariable()

CcwResult WINAPI SetVariable ( DWORD  device,
wchar_t *  var,
void *  value 
)

Set the value of an internal "parameter"

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]varA null terminated string that is the variable ID.
[in]valuepointer to the value to assign to the variable.
Note
Only for internal use
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ SetVirtualPaperEndLimit()

CcwResult WINAPI SetVirtualPaperEndLimit ( DWORD  device,
DWORD  dwVirtualPaperEndLimitCm 
)

Set the Virtual Paper End limit of this device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]dwVirtualPaperEndLimitCmThe number that will be the virtual paper end limit, expressed in cm, of this device (for e.g. "1500" is to set 15m)
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.

◆ TransactionPrint()

CcwResult WINAPI TransactionPrint ( DWORD  device,
TrPrintMode  tpMode 
)

Manage the Transaction Print of the device

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]tpModeTransaction control.
Returns
A CcwResult error code, or CcwResult_OK if the function succeeded.